package com.laosg.study.base.ch3

/**
  * Created by kaimin on 4/5/2019.
  * time : 21:21
  */
object CatDemo {

  def main(args: Array[String]): Unit = {

    val cat = new Cat
    cat.name="hua"
    cat.age=18
    cat.color="red"

    println(cat.toString)

    var res=1L
    "Hello".foreach(res*=_.toLong)
    println(res)
    var dog = new Dog("aa",18)
    println(dog.name)
    println(dog)

  }

}
class Cat(){
  //范围默认是private的
  var name:String=""
  var age:Int= _
  var color:String=""

}
class Dog(InName:String,InAge:Int){
  var name=InName;
  var age=InAge;

  override def toString: String = {
    "name="+this.name+" age="+this.age
  }
}
